home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / Re RE>How to embed a part into < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.2 KB  |  [TEXT/ttxt]

  1. Subject:     Re: RE>How to embed a part into yourself
  2. Sent:        6/14/96 12:01 PM
  3. Received:    6/14/96 12:11 PM
  4. From:        Damon Cokenias, cokenias@mtn-palace.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. Rob, I just want to make sure you're doing the right thing here.  I see the
  9. potential for a couple of problems.
  10.  
  11. >                ODPart* odEmbeddedPart;
  12. >       ...
  13. >                odEmbeddedPart->Release(ev);
  14.  
  15. It is important that you use the ODF acquisition objects for this sort of
  16. thing.  If an exception is thrown, your code will never call
  17. odEmbeddedPart->Release().  Your
  18. code should be written like this:
  19.  
  20. {
  21.         FW_CAcquiredODPart odEmbeddedPart = su->GetDraft(ev)->CreatePart(...)
  22.  
  23.         ...
  24. }
  25.  
  26. When the FW_CAcquiredODPart object goes out of scope (either when the
  27. function returns or when an exception is thrown) the ODPart will be
  28. released correctly.  ODF has many such acquisition objects
  29. (FW_CAcquiredODShape, for instance).  Use them exclusively when dealing
  30. with refCounted objects that you only hold on to for a short period of
  31. time.  You do the correct thing in your code when you use the
  32. FW_CAcquiredODShape.
  33.  
  34.  
  35. >                odEmbeddedPart->Externalize(ev);
  36.  
  37. As far as I can tell, this is not necessary.  Once the part is embedded,
  38. OpenDoc will ensure that it gets externalized.  Manually externalizing will
  39. simply slow the embed process.
  40.  
  41. Finally (and I am sure you know this) your override of
  42. SingleEmbeddedFrameInternalized needs to do the right thing to actually
  43. embed the part.  (I only mention this because it may not be obvious to
  44. other people reading this post).  Your override must create an FW_MProxy
  45. object and call the presentation's Embed method.  For more information on
  46. this, please see my previous posting.
  47.  
  48. Otherwise, looks good!
  49.  
  50. -Damon
  51. Quality ODF Guy
  52.  
  53.  
  54. +-----------------------------------------------------------------------+
  55. |   /\    Damon Cokenias                                                |
  56. |  /^^\   cokenias@mtn-palace.com                                       |
  57. | /____\  Visit the Mountain Palace at http://www.netgate.net/~cokenias |
  58. +-----------------------------------------------------------------------+
  59.  
  60.